﻿using System;
using System.ComponentModel.DataAnnotations;
using Util.Domains.Trees;

namespace IterationLife.ContentResources.Queries {
    /// <summary>
    /// 内容资源评论查询实体
    /// </summary>
    public class ContentResourceCommentQuery : TreeQueryBase {
        /// <summary>
        /// 内容资源评论编号
        /// </summary>
        [Display(Name="内容资源评论编号")]
        public Guid? ContentResourceCommentId { get; set; }
        /// <summary>
        /// 内容资源编号
        /// </summary>
        [Display(Name="内容资源编号")]
        public Guid? ContentResourceId { get; set; }
        
        private string _content = string.Empty;
        /// <summary>
        /// 内容
        /// </summary>
        [Display(Name="内容")]
        public string Content {
            get { return _content == null ? string.Empty : _content.Trim(); }
            set{ _content=value;}
        }
        /// <summary>
        /// 用户编号
        /// </summary>
        [Display(Name="用户编号")]
        public Guid? UserId { get; set; }
        
        private string _userName = string.Empty;
        /// <summary>
        /// 用户名
        /// </summary>
        [Display(Name="用户名")]
        public string UserName {
            get { return _userName == null ? string.Empty : _userName.Trim(); }
            set{ _userName=value;}
        }
        /// <summary>
        /// 起始创建时间
        /// </summary>
        [Display( Name = "起始创建时间" )]
        public DateTime? BeginCreationTime { get; set; }
        /// <summary>
        /// 结束创建时间
        /// </summary>
        [Display( Name = "结束创建时间" )]
        public DateTime? EndCreationTime { get; set; }        
        /// <summary>
        /// 起始最后修改时间
        /// </summary>
        [Display( Name = "起始最后修改时间" )]
        public DateTime? BeginLastModificationTime { get; set; }
        /// <summary>
        /// 结束最后修改时间
        /// </summary>
        [Display( Name = "结束最后修改时间" )]
        public DateTime? EndLastModificationTime { get; set; }        
        /// <summary>
        /// 最后修改人
        /// </summary>
        [Display(Name="最后修改人")]
        public Guid? LastModifierId { get; set; }
        
        /// <summary>
        /// 添加描述
        /// </summary>
        protected override void AddDescriptions() {
            base.AddDescriptions();
            AddDescription( "内容资源评论编号", ContentResourceCommentId );
            AddDescription( "内容资源编号", ContentResourceId );
            AddDescription( "内容", Content );
            AddDescription( "用户编号", UserId );
            AddDescription( "用户名", UserName );
            AddDescription( "起始创建时间", BeginCreationTime );
            AddDescription( "结束创建时间", EndCreationTime );
            AddDescription( "起始最后修改时间", BeginLastModificationTime );
            AddDescription( "结束最后修改时间", EndLastModificationTime );
            AddDescription( "最后修改人", LastModifierId );
        }
        
        /// <summary>
        /// 检查查询参数是否全部为空
        /// </summary>
        protected override void CheckEmpty() {
            base.CheckEmpty();
            AddValue( ContentResourceCommentId );
            AddValue( ContentResourceId );
            AddValue( Content );
            AddValue( UserId );
            AddValue( UserName );
            AddValue( BeginCreationTime );
            AddValue( EndCreationTime );
            AddValue( BeginLastModificationTime );
            AddValue( EndLastModificationTime );
            AddValue( LastModifierId );
        }
    }
}
